//
//  LoginInputView.swift
//  NDAi
//
//  Created by 丸子 on 2024/6/3.
//

import UIKit

class LoginInputView: UIView {
    lazy var iconIV: UIImageView = {
        let imageView = UIImageView()
        return imageView
    }()
    
    lazy var phoneNumberTextField: UITextField = {
        let textField = UITextField()
        textField.placeholder = "请输入手机号"
        textField.font = UIFont.pingFangSCRegular(ofSize: 16)
        textField.borderStyle = .none
        textField.keyboardType = .numberPad
        textField.textColor = Theme.color.text_d3
        // iOS 10及以上版本支持自动填充手机号
        return textField
    }()
    
    lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = Theme.color.lineColor
        return view
    }()
    
    lazy var codeBtn: UIButton = {
        let button = UIButton(type: .custom)
        button.backgroundColor = Theme.color.main
        button.allRound(15)
        button.setTitle("获取验证码", for: .normal)
        button.setTitleColor(UIColor.white, for: .normal)
        button.titleLabel?.font = UIFont.pingFangSCRegular(ofSize: 11)
        button.isHidden = true
        return button
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubviews([iconIV, phoneNumberTextField, codeBtn, lineView])
        
        lineView.snp.makeConstraints { make in
            make.bottom.equalToSuperview()
            make.leading.trailing.equalToSuperview().inset(40)
            make.height.equalTo(1)
        }
        
        iconIV.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.leading.equalTo(lineView.snp.leading)
            make.width.height.equalTo(24)
        }
        
        phoneNumberTextField.snp.makeConstraints { make in
            make.leading.equalTo(iconIV.snp.trailing).offset(10)
            make.trailing.equalTo(codeBtn.snp.leading)
            make.top.bottom.equalToSuperview()
        }
        
        codeBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.trailing.equalTo(lineView.snp.trailing)
            make.width.equalTo(78)
            make.height.equalTo(30)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
}
